let fs = require('fs');

let rs = fs.createReadStream('01.jpg');
let ws = fs.createWriteStream('03.jpg');

rs.once('open',function () {
  console.log('可读开启')
})
rs.once('close',function () {
  console.log('可读关闭')
  ws.end()
})

ws.once('open',function () {
  console.log('可写开启')
})
ws.once('close',function () {
  console.log('可写关闭')
})

// rs.on('data',function (data) {
//   ws.write(data,function (err) {
//
//   })
// })

rs.pipe(ws)